{include file="public/header" /}
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
    <legend>管理员{notempty name="user"}修改{else/ }添加{/notempty}</legend>
</fieldset>

<form class="layui-form" action="" method="post">

    {notempty name="user"} <input type="hidden" name="id" value="{$user.id}"> {/notempty}

    <div class="layui-form-item">
        <label class="layui-form-label">管理员账号</label>
        <div class="layui-input-block">
            <input type="text" name="admin_name" required {notempty name="user"} value="{$user.admin_name}" {/notempty} lay-verify="required" placeholder="请输入管理员账号" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">管理员密码</label>
        <div class="layui-input-block">
            <input type="password" name="admin_pwd" {empty name="user"} required {/empty}  placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <input type="radio" name="status" value="0" title="启用" {notempty name="user"}{if $user['status']==0}checked{/if}{else/ }checked{/notempty}>
            <input type="radio" name="status" value="1" title="未启用"{notempty name="user"}{if $user['status']==1}checked{/if}{/notempty}>
        </div>
    </div>

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend>管理员角色分配</legend>
    </fieldset>

    <blockquote class="layui-elem-quote layui-quote-nm">


        <div class="layui-form-item">
            <div class="layui-input-block">
                {foreach $role as $v}
                <input type="checkbox" name="role_id[]" value="{$v.id}" {notempty name="a_r"}{if in_array($v.id,$a_r)}checked {/if}{/notempty} title="{$v.role_name}">
                {/foreach}
            </div>
        </div>

    </blockquote>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){

        });
    });
</script>

{include file="public/footer" /}